﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Primenumber
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入下限");
            int low =int.Parse(Console.ReadLine());
            
            Console.WriteLine("请输入上限");
            int up = int.Parse(Console.ReadLine());

            int count = 0;
            for (int i = low; i <= up; i++)
            {
                if (Isprime(i))
                {
                    Console.Write(i+" ");
                    count++;
                    if (count % 10 == 0)
                    {
                        Console.WriteLine();
                    }
                }
            }

            Console.ReadKey();
        }
        static bool Isprime(int i)
        {
            if (i <= 1)
                return false;
            if (i == 2)
                return true;
            if (i % 2 == 0)
                return false;
            for (int j = 3; j * j <= i; j += 2)
            {
                if (i % j == 0)
                    return false;
            }
            return true;
        }
    }
}
